package jp.co.brilliantservice.app.sos;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class BeatTimerReceiver extends BroadcastReceiver {
    // private static int count = 0;
	@Override
	public void onReceive(Context context, Intent intent) {
		SettingManager mPref = new SettingManager(context);
		Intent it = new Intent(context, TwitterService.class);
        String target = mPref.get("target");
        String name = mPref.get("name");
        String pattern = "pattern"+(mPref.get("current_pattern"));
        String text = mPref.get(pattern);
        // String[] texts = text.split("\n");
        String hashtag = mPref.get("hashtag");
        // it.putExtra("text", texts[count]);
        // count = (count + 1) % texts.length;
        it.putExtra("target", target);
        
        text = String.format("%s：%s #%s",name ,text ,hashtag);
        it.putExtra("text", text);

        mPref.setBoolean("complete", true);
		context.startService(it);
	}
}
